package com.wewins.fota.bean.dto;

import com.wewins.fota.common.constant.HttpConst;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class ResponseRst<T> {
    private int status;

    private String message;

    private T data;

    public ResponseRst<T> withOk() {
        this.status = HttpConst.STATUS_OK;
        return this;
    }

    public ResponseRst<T> withSpecialOk(int status) {
        this.status = status;
        return this;
    }

    public ResponseRst<T> withDefaultError(String message) {
        return this.withError(HttpConst.STATUS_ERROR, message);
    }

    public ResponseRst<T> withError(int status, String message) {
        this.status = status;
        this.message = message;
        return this;
    }
}
